<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <script>

        const user = '123' ;
        if(userFN(user)) {}

    </script>

    <script>

        function regTest(reg) {
            return function(str) {
                return reg.test(str)
            }
        }

        const userFN = regTest(/./) ;

        const pwdFN = regTest(/./) ;




    </script>
    
</body>
</html>